package com.qf.service.impl;

import com.qf.dao.RepairsFormDao;
import com.qf.pojo.RepairsForm;
import com.qf.pojo.resp.BaseResult;
import com.qf.service.RepairsFormService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class RepairsFormServiceImpl implements RepairsFormService {
    BaseResult result = new BaseResult();
    @Resource
    RepairsFormDao repairsFormDao;

    public BaseResult findAllRepairs(){
        List<RepairsForm> allRepairs = repairsFormDao.findAllRepairs();
        result.setData(allRepairs);
        result.setCode(1);
        return result;
    }

    @Override
    public BaseResult addOne(RepairsForm repairsForm) {
        Integer one = repairsFormDao.addOne(repairsForm);
        if (one > 0) {
            result.setData(one);
            result.setCode(1);
            result.setInfo("提交成功");
            return result;
        }
        result.setCode(0);
        result.setInfo("提交失败");
        return result;
    }
}
